home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / pipe.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  1.7 KB  |  67 lines

  1.  
  2.  
  3.  
  4. PIPE(3)             MINTLIB LIBRARY FUNCTIONS             PIPE(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        pipe - create an interprocess communication channel
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.  
  13.        int pipe(int fd[2]);
  14.  
  15. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  16.        This function only works when MiNT is active.
  17.  
  18.        The  pipe  system  call  creates an I/O mechanism called a
  19.        pipe and returns two file descriptors,  fd[0]  and  fd[1].
  20.        fd[0]  is opened for reading and fd[1] is opened for writ-
  21.        ing.  When the pipe is written using the descriptor  fd[1]
  22.        up  to  4096 bytes of data are buffered before the writing
  23.        process is blocked.  A read  only  file  descriptor  fd[0]
  24.        accesses  the  data  written to fd[1] on a FIFO (first-in-
  25.        first-out) basis.
  26.  
  27.        The standard programming model is that after the pipe  has
  28.        been  set up, two (or more) cooperating processes (created
  29.        by subsequent fork calls) will pass data through the  pipe
  30.        using read and write.
  31.  
  32.        Read  calls  on an empty pipe (no buffered data) with only
  33.        one end (all write file descriptors closed) returns an EOF
  34.        (end of file).
  35.  
  36.        A  SIGPIPE  signal  is generated if a write on a pipe with
  37.        only one end is attempted.
  38.  
  39. R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
  40.        pipe returns:
  41.  
  42.         0 on success.  -1 on failure and sets errno  to  indicate
  43.        the error.
  44.  
  45. N✓NO✓OT✓TE✓ES✓S
  46.        in MiNT, pipes are really the same as FIFOs.
  47.  
  48. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  49.        f✓fo✓or✓rk✓k(✓(3✓3)✓),✓, r✓re✓ea✓ad✓d(✓(3✓3)✓),✓, w✓wr✓ri✓it✓te✓e(✓(3✓3)✓),✓, s✓si✓ig✓gn✓na✓al✓l(✓(3✓3)✓),✓, F✓Fp✓pi✓ip✓pe✓e(✓(2✓2)✓)
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.